/**
 * 
 */
package org.insia.smartposse.xfire.handler;

import org.apache.log4j.Logger;
import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.fault.XFireFault;
import org.codehaus.xfire.handler.AbstractHandler;

/**
 * @author raguerri
 * @since 14 avr. 07
 * @version 0.0.1
 * 
 */
public class AuthenticationHandler extends AbstractHandler {

	protected final Logger log = Logger.getLogger(getClass());

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.codehaus.xfire.handler.Handler#invoke(org.codehaus.xfire.MessageContext)
	 */
	public void invoke(MessageContext context) throws XFireFault {
		if (context.getSession().get("user") == null) {
			log.error("Request must be authenticated.");
			throw new XFireFault(
					"Request must be authenticated.",
					XFireFault.SENDER);
		}
	}
}
